package seday02;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo01 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("image.jpg");
        FileOutputStream fos = new FileOutputStream("image02.jpg");
        long start = System.currentTimeMillis();
       /* int d;
        while ((d = fis.read()) != -1){
            fos.write(d);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完成,用时"+ (end-start));
        fis.close();
        fos.close();*/
        byte[] date = new byte[1024*10];
        int d ;
        while ((d = fis.read(date)) !=-1){
            fos.write(date,0,d);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完成,用时"+ (end-start));
        fis.close();
        fos.close();
    }
}
